package com.reason.user.controller;




import com.reason.common.pojo.Result;
import com.reason.common.pojo.StatusCode;
import com.reason.user.pojo.Condition;
import com.reason.user.service.ConditionService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.List;



/**
 * @author  yulongjun
 * @date 2020/6/29 10:42 下午
 */
@RestController
@RequestMapping("/condition")
public class ConditionController {
    @Autowired
    private ConditionService selectionService;

    /**
     * 查找所有
     * @return
     */
    @GetMapping("/findAll")
    public Result<List<Condition>> findAll(){
        List<Condition> aLl =selectionService.findALl();
        return new Result<List<Condition>>(true, StatusCode.OK,"查询成功",aLl);
    }

    /**
     * 根据ID查询Condition
     * @param Id
     * @return
     */
    @GetMapping("/findById/{Id}")
    public Condition findById(@PathVariable("Id") Long Id){
        Condition condition=selectionService.findByID(Id);
        if(condition==null){
            return null;
        }
        return condition;
    }


}
